package program_structure;

public class BranchStructure {
    public static void main(String[] args) {
        //if语句
        int score = 50;
        if(score > 60);{
            System.out.println("成绩合格");
        }
        System.out.println("成绩不合格");

        int age = 20;
        if(age >= 18){
            System.out.println("已成年");
        }else{
            System.out.println("还是未成年");
        }

        int num = -9;
        if(num == 0){
            System.out.println("该数为 0");
        }else if(num > 0){
            System.out.println("该数为正数");
        }else{
            System.out.println("该数为负数");
        }

        //switch语句举例1
        int day = 6;
        switch(day){
            case 1:
                System.out.println("星期一");
                break;
            case 2:
                System.out.println("星期二");
                break;
            case 3:
                System.out.println("星期三");
                break;
            case 4:
                System.out.println("星期四");
                break;
            case 5:
                System.out.println("星期五");
                break;
            case 6:
                System.out.println("星期六");
                break;
            case 7:
                System.out.println("星期日");
                break;
            default:
                System.out.println("输入有误！");
                    break;
        }
        //switch语句举例2
        String a = "你好";
        switch(a){
            case "你好":
                System.out.println("你好");
                break;
            case "早上好":
                System.out.println("早上好");
                break;
            case "晚上好":
                System.out.println("晚上好");
                break;
            case "晚安":
                System.out.println("晚安");
                break;
            default:
                System.out.println("哈哈哈");
                break;
        }

    }
}
